package com.cacho.s2b.lesson.design;

/**
 * @Description 单例模式：6.双重检查【推荐使用】
 * @Author LingWei
 * @date 2023/12/14
 **/
public class Singleton6 {
    private static volatile Singleton6 instance;
    private Singleton6(){}
    public static Singleton6 getInstance(){
        if (instance == null){
            synchronized (Singleton6.class){
                if (instance == null){
                    instance = new Singleton6();
                }
            }
        }
        return instance;
    }
}